#include <analysis.h>
#include <cvirte.h>		
#include <userint.h>
#include "wave.h"
static double p[100];
static double sine[100];

static int panelHandle;

int main(int argc, char *argv[]) {
	if (InitCVIRTE(0, argv, 0) == 0)
		return -1; /* out of memory */
	if ((panelHandle = LoadPanel(0, "wave.uir", PANEL)) < 0)
		return -1;
	DisplayPanel(panelHandle);
	RunUserInterface();
	DiscardPanel(panelHandle);
	return 0;
}

int CVICALLBACK Acquirecallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) {
	double Wave[100];
	switch (event) {
		case EVENT_COMMIT:
		SinePattern (100, 1.0, 0.0, 1.0, Wave);
		PlotWaveform (panelHandle, PANEL_GRAPH, Wave, 100, VAL_DOUBLE, 1.0, 0.0, 0.0, 1.0, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED);
		break;
	}
	return 0;
}

int CVICALLBACK Clearcallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) {
	switch (event) {
		case EVENT_COMMIT:
		DeleteGraphPlot (panelHandle, PANEL_GRAPH, -1, VAL_IMMEDIATE_DRAW);
		break;
	}
	return 0;
}

int CVICALLBACK Quitcallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) {
	switch (event) {
		case EVENT_COMMIT:
		QuitUserInterface (0);
		break;
	}
	return 0;
}
